package com.netease.pris.c;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import android.net.Uri;
import android.text.TextUtils;
import com.netease.pris.atom.u;
import com.netease.pris.protocol.a;
import com.netease.pris.protocol.h;
import com.netease.pris.provider.p;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class e
{
  static String[] a;
  public static final int b = 0;
  public static final int c = 1;
  public static final int d = 2;
  public static final int e = 3;
  public static final int f = 4;
  public static final int g = 5;
  public static final int h = 6;
  public static final int i = 7;
  public static final int j = 8;
  private static final String k = "f";

  static
  {
    String[] arrayOfString = new String[9];
    arrayOfString[0] = "_id";
    arrayOfString[1] = "account";
    arrayOfString[2] = "uid";
    arrayOfString[3] = "updated";
    arrayOfString[4] = "timestamp";
    arrayOfString[5] = "other";
    arrayOfString[6] = "file";
    arrayOfString[7] = "title";
    arrayOfString[8] = "type";
    a = arrayOfString;
  }

  private static LinkedList a(Context paramContext, String paramString1, String paramString2, boolean paramBoolean)
  {
    Cursor localCursor;
    LinkedList localLinkedList;
    String str;
    if (paramContext != null)
    {
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = p.j;
      String[] arrayOfString1 = a;
      String[] arrayOfString2 = new String[1];
      arrayOfString2[0] = paramString1;
      localCursor = localContentResolver.query(localUri, arrayOfString1, "account =?", arrayOfString2, "timestamp DESC");
      if (localCursor != null)
        if (localCursor.moveToFirst())
        {
          localLinkedList = new LinkedList();
          if (paramBoolean)
          {
            str = localCursor.getString(6);
            if (TextUtils.isEmpty(str))
            {
              label95: if (localCursor.moveToNext())
                break label205;
              localCursor.close();
            }
          }
        }
    }
    while (true)
    {
      while (true)
      {
        return localLinkedList;
        try
        {
          new h(new a(new g(localLinkedList))).a(com.netease.pris.a.e.a(str));
        }
        catch (Exception localException)
        {
          localException.printStackTrace();
        }
      }
      break label95;
      u localu = new u();
      localu.q(localCursor.getString(2));
      localu.r(localCursor.getString(7));
      localLinkedList.add(localu);
      break label95;
      label205: break;
      localCursor.close();
      localLinkedList = null;
    }
  }

  public static LinkedList a(Context paramContext, String paramString, boolean paramBoolean)
  {
    return a(paramContext, paramString, null, paramBoolean);
  }

  public static void a(Context paramContext, String paramString, u paramu)
  {
    if ((paramContext == null) || (TextUtils.isEmpty(paramString)) || (paramu == null));
    while (true)
    {
      return;
      ContentValues localContentValues = new ContentValues();
      localContentValues.put("account", paramString);
      localContentValues.put("uid", paramu.V());
      localContentValues.put("updated", paramu.Y());
      localContentValues.put("timestamp", Long.valueOf(System.currentTimeMillis()));
      localContentValues.put("title", paramu.U());
      localContentValues.put("type", "f");
      localContentValues.put("file", paramu.toString());
      paramContext.getContentResolver().insert(p.j, localContentValues);
    }
  }

  public static void a(Context paramContext, String paramString, LinkedList paramLinkedList)
  {
    if ((paramLinkedList == null) || (paramLinkedList.size() <= 0));
    while (true)
    {
      return;
      LinkedList localLinkedList = new LinkedList();
      Iterator localIterator = paramLinkedList.iterator();
      while (localIterator.hasNext())
      {
        u localu = (u)localIterator.next();
        if (localu == null)
          continue;
        localLinkedList.add(localu.V());
      }
      a(paramContext, paramString, localLinkedList);
    }
  }

  public static void a(Context paramContext, String paramString, List paramList)
  {
    if ((paramContext == null) || (paramList == null) || (paramList.size() == 0));
    while (true)
    {
      return;
      StringBuilder localStringBuilder = new StringBuilder();
      localStringBuilder.append("account").append(" = '").append(paramString).append("' AND ").append("uid").append(" in (");
      Iterator localIterator = paramList.iterator();
      while (localIterator.hasNext())
      {
        String str = (String)localIterator.next();
        localStringBuilder.append('\'').append(str).append('\'').append(',');
      }
      localStringBuilder.deleteCharAt(-1 + localStringBuilder.length());
      localStringBuilder.append(')');
      paramContext.getContentResolver().delete(p.j, localStringBuilder.toString(), null);
    }
  }

  private static void a(SQLiteStatement paramSQLiteStatement, int paramInt, String paramString)
  {
    if (paramString == null)
      paramSQLiteStatement.bindNull(paramInt);
    while (true)
    {
      return;
      paramSQLiteStatement.bindString(paramInt, paramString);
    }
  }

  public static boolean a(Context paramContext, String paramString1, String paramString2)
  {
    int m = 1;
    if (paramContext != null)
    {
      ContentResolver localContentResolver = paramContext.getContentResolver();
      Uri localUri = p.j;
      String[] arrayOfString = new String[2];
      arrayOfString[0] = paramString1;
      arrayOfString[m] = paramString2;
      if (localContentResolver.delete(localUri, "account =?  AND uid =?", arrayOfString) <= 0);
    }
    while (true)
    {
      return m;
      m = 0;
      continue;
      m = 0;
    }
  }

  public static boolean b(Context paramContext, String paramString1, String paramString2)
  {
    return a(paramContext, paramString1, paramString2);
  }

  public static boolean c(Context paramContext, String paramString1, String paramString2)
  {
    int m;
    if ((paramContext == null) || (TextUtils.isEmpty(paramString1)) || (TextUtils.isEmpty(paramString2)))
      m = 0;
    while (true)
    {
      return m;
      String str = "account = '" + paramString1 + "' AND " + "uid" + " = '" + paramString2 + "'";
      Cursor localCursor = paramContext.getContentResolver().query(p.j, a, str, null, null);
      if (localCursor != null)
      {
        if (localCursor.moveToFirst());
        for (m = 1; ; m = 0)
        {
          localCursor.close();
          break;
        }
      }
      m = 0;
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.c.e
 * JD-Core Version:    0.6.0
 */